package com.frank.activedatatest;

import com.frank.activedatabus.ActiveDataBus;
import ohos.aafwk.ability.AbilityPackage;
import ohos.aafwk.ability.ILifecycle;
import ohos.aafwk.ability.Lifecycle;
import ohos.aafwk.content.Intent;

import java.util.concurrent.Executors;

public class MyApplication extends AbilityPackage implements ILifecycle {

    private Lifecycle mLifeCycle = new Lifecycle();

    private Intent mIntent = new Intent();

    public static MyApplication instance;

    @Override
    public void onInitialize() {
        super.onInitialize();
        instance = this;
        mLifeCycle.dispatchLifecycle(Lifecycle.Event.ON_START, mIntent);
        ActiveDataBus.config().setThreadPoolExecutor(Executors.newFixedThreadPool(3));
    }

    @Override
    public void onEnd() {
        super.onEnd();
        mLifeCycle.dispatchLifecycle(Lifecycle.Event.ON_STOP, mIntent);
    }

    @Override
    public Lifecycle getLifecycle() {
        return mLifeCycle;
    }

}
